<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      /*

        继承
        ① this 继承 ：属性复制，方法共享
        ② 静态属性和方法的继承：子类类名直接调用父类静态属性和方法，其本质子类对象原型指向了父类对象，他们是原型继承，是通过原型链查找的。
        */
      class Person {
        static username = "jack";
        username = "lili";
        static say() {
          console.log("hello jack");
        }
        say() {
          console.log("hello lili");
        }
      }
      // Person = { username: "", say: "" };
      class Admin extends Person {}
      // Admin = {
      //   __proto__: Person
      // }
      console.log(Admin.username); //jack
      Admin.say(); //jack
      console.log(Admin.__proto__ === Person); //true

      const ad = new Admin();
      ad.say(); //hello lili
      console.log(ad.username); //lili 复制
    </script>
  </body>
</html>
